package com.neuedu.his.dao;

import com.neuedu.his.entity.UserRole;
import com.neuedu.util.JDBCUtil;

import java.util.List;

public class UserRoleDao {


    /**
     * 根据用户id 查询权限
     * @param id
     * @return
     */
    public List<UserRole> selectUserRole( Integer id){
        String sql = "select * from user_role where user_id = ?";
        return JDBCUtil.executeQuery(sql,UserRole.class,id);
    }

    //delete from user_role where user_id = ?
    public boolean delete(String sql,String userId){
        return JDBCUtil.executeUpdate(sql,userId);
    }



    public boolean insert(UserRole userRole){
        String sql = "insert into user_role values(?,?)";
        return JDBCUtil.executeUpdate(sql,userRole.getUserId(),userRole.getRoleId());
    }
}
